﻿using UnityEditor;

namespace HKTools
{
    [CustomEditor(typeof(HK_Curve2D))]
    public class HK_Curve2DEditor : Editor
    {
        static SerializedProperty curve;

        static SerializedProperty color;
        static SerializedProperty sprite;

        static SerializedProperty lineWidth;
        static SerializedProperty accuracy;
        static SerializedProperty textureTiling;
        static SerializedProperty textureOffset;

        void OnEnable()
        {
            curve = serializedObject.FindProperty("curve");

            sprite = serializedObject.FindProperty("m_Sprite");
            color = serializedObject.FindProperty("m_Color");

            lineWidth = serializedObject.FindProperty("lineWidth");
            accuracy = serializedObject.FindProperty("accuracy");
            textureTiling = serializedObject.FindProperty("textureTiling");
            textureOffset = serializedObject.FindProperty("textureOffset");
        }

        public override void OnInspectorGUI()
        {
            //base.OnInspectorGUI();

            EditorGUILayout.PropertyField(curve);

            EditorGUILayout.PropertyField(color);
            EditorGUILayout.PropertyField(sprite);

            EditorGUILayout.PropertyField(lineWidth);
            EditorGUILayout.PropertyField(accuracy);
            EditorGUILayout.PropertyField(textureTiling);
            EditorGUILayout.PropertyField(textureOffset);

            serializedObject.ApplyModifiedProperties();
        }
    }
}